<?php

/*
*###########################################################################################################################*
#															    															#
#															    															#
#    **  ** ****** ** **  **  ****** ** ***   ** ***   ****** ** **  **  ** **  ** ** **  **    ****   ** **  **  ******    #
#    **  ** ****** ********** ****** *******  *******  ****** ********** ** **  ** **********  ******  ********** ******    #
#    **  ** **  ** **  **  ** **     ***   ** **    ** **     **  **  **    **  ** **  **  ** ***   ** **  **  ** **        #
#    ****** **  ** **  **  ** ****** **   *** **   *** ****** **  **  ** ** **  ** **  **  ** **       **  **  ** ******    #
#    ****** **  ** **  **  ** ****** *******  *******  ****** **  **  ** ** **  ** **  **  ** **       **  **  ** ******    #
#    **  ** **  ** **  **  ** **     *****    ******   **     **  **  ** ** **  ** **  **  ** ***   ** **  **  **     **    #
#    **  ** ****** **  **  ** ****** **       **  ***  ****** **  **  ** ** ****** **  **  **  ******  **  **  ** ******    #
#    **  ** ****** **  **  ** ****** **       **   *** ****** **  **  ** **  ** ** **  **  **   ****   **  **  ** ******    #
#															    															#
#															    															#
#															    															#
#    2010 - 2011 © HomePremiumCMS made by HomePemium as PremiumEye & Security by HomePremium and Merijnz		    		#
#															    															#
#    Powered by PhoenixPHP 3.7.1 (build 138000)										    									#
#															    															#
#															    															#
#															    															#
*###########################################################################################################################*
*/

define('USERNAME_REQUIRED', TRUE);
define('ACCOUNT_REQUIRED', TRUE);
include('global.php');
define("THIS_SCRIPT", 'settings');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<head>
<title><?php echo $sitename." - ".$lang['settings']; ?></title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript" src="Public/JS/jquery.history.js"></script>
	<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.pack.js"></script>
	<script type="text/javascript" language="javascript" src="js/checkbox_radio_show.js"></script>
</head> 

<script type="text/javascript">

	function doCheckMail() {
		name = $("#email").val();
		$.get("./register/mailcheck", {ajaxAct: "check_habbo_name", mail: name}, function(data) {
			if( $.trim(data) == "0" ) {
				$("#habbo_name_message_box").html("<?php echo $lang['settings_mail_error']; ?>");
				$("#habbo_name_message_box").removeClass().addClass("errormsg");
				MailisFree = 0;
			} else {
				MailisFree = 1;
			}
		});
	}

$().ready(function() {
	$('#email').keypress(function(e){
		if(e.which == 13){
			doCheckMail();
		}
	});

	$('#email').blur(function(e){
		doCheckMail();
	});

	$("#UserEmail").validate({
		submitHandler: function(form) {
			doCheckMail();
			if (MailisFree === 1) {
				form.submit();
			}
		},
		rules: {
			email: {
				required: true,
				email: true
			}
		},
		messages: {
			email: "<?php echo $lang['settings_mail_invalid']; ?>"
		}
	});	
});

MailisFree = 0;

</script>

<link type="text/css" rel="stylesheet" href="Public/Styles/<?php echo $currentstyle ?>/CSS/main.css" />

<?php
if(!isset($_GET['page']))
$_GET['page'] = 'general';
?>

<body id="news_body"> 
 
	<?php include("system/header_home.php"); ?>
<div class="mainBox"> 
	<?php include("system/homenav.php"); ?>
    
	<div class="mid" id="midcontent" style="margin-left: -4px;"> 

<style type="text/css">
.contentBox {
	color: #333333;
}

.boxContent {
	color: #333333;
}

.boxContent2 a {
	color: #333333;
}

.boxContent2 a:hover {
	color: #333333;
	text-decoration: underline;
}

div.boxContent2 {
	padding:5px 5px 5px 5px;
}

#habbo_name_message_box {
	border-radius: 4px;
}
</style>

<div class="column" id="column1">
<div class="xs_boxHeader_grey"><div class="titel"><?php echo $lang['settings_left_title']; ?></div></div>
	<div class="contentBox">
    <div class="boxContent2">
    
<a href="?page=general" style="<?php if($_GET['page'] == 'general') echo 'font-weight: bold;'; else { echo ''; } ?>padding-left: 5px;">   
			<?php echo $lang['settings_left_my_preferences']; ?>
</a><br />
<a href="?page=password" style="<?php if($_GET['page'] == 'password') echo 'font-weight: bold;'; else { echo ''; } ?>padding-left: 5px;padding-top:4px;">
			<?php echo $lang['password_settings']; ?>
</a><br />
<a href="?page=header" style="<?php if($_GET['page'] == 'header') echo 'font-weight: bold;'; else { echo ''; } ?>padding-left: 5px;padding-top:4px;">
            <?php echo $lang['settings_left_header']; ?>
</a>
</div>
	</div>
<div class="xs_boxBottom"></div>
</div>

<div class="column" id="column2">

				<?php
		$userq = mysql_query("SELECT * FROM users WHERE username = '".$core->EscapeString($_SESSION['username'])."' LIMIT 1");
		$user = mysql_fetch_array($userq);
        if($_GET['page'] == 'general')
		{
		?>
<div style="margin-left: 5px;" class="xl_boxHeader_grey"><div class="titel"><?php echo $lang['settings_left_my_preferences']; ?></div></div>
	<div style="margin-left: 5px; margin-right: 5px;" class="contentBox">
			<div class="boxContent" style="display: table; width: 100%;">
				<?php
                if(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'false')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_general_error']; ?></h3> 
					</div>
				<?php
				}
                elseif(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'true')
				{
				?>
					<div class="goodmsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_general_updated']; ?></h3> 
					</div>
				<?php
				}
				?>
				<form name="UserSettings" action="functions/updateusersettings.php" method="post">
                	<p>
                    <label for="friendreqs"><b style="font-size: 12px;"><?php echo $lang['settings_right_status']; ?></b><br /><?php echo $lang['settings_right_status_second']; ?></label><br />
                    <?php echo $lang['settings_right_status_tit']; ?>:
					<input type="text" name="status" id="status" style="width: 300px;" value="<?php echo html_entity_decode($core->EscapeString($users->UserInfo($username, 'motto'))); ?>" />
					</p>
                    
                    <p>
                    <label for="profiel_zichtbaar"><b style="font-size: 12px;"><?php echo $lang['settings_right_profile']; ?></b><br /><?php echo $lang['settings_right_profile_second']; ?>:</label><br />
					<input type="radio" name="profiel_zichtbaar" id="profiel_zichtbaar" <?php if($user['profiel_zichtbaar'] == 'ja') echo 'checked=checked'; ?> value="ja" /><?php echo $lang['settings_right_profile_option1']; ?>
                    <input type="radio" name="profiel_zichtbaar" id="profiel_zichtbaar" <?php if($user['profiel_zichtbaar'] == 'nee') echo 'checked=checked'; ?> value="nee" /><?php echo $lang['settings_right_profile_option2']; ?>
					</p>
                
					<p>
                    <label for="friendreqs"><b style="font-size: 12px;"><?php echo $lang['settings_right_friendships']; ?></b></label><br />
					<input type="checkbox" name="friendreqs" id="friendreqs" <?php if($user['block_newfriends'] == 0) echo 'checked=checked'; ?> /><?php echo $lang['settings_right_friendships_allow']; ?>
					</p>
                    
					<p>
                    <label for="online"><b style="font-size: 12px;"><?php echo $lang['settings_right_online']; ?></b></label><br />
					<input type="checkbox" name="online" id="online" <?php if($user['hide_online'] == 0) echo 'checked=checked'; ?>  /><?php echo $lang['settings_right_online_allow']; ?>
					</p>
                    
					<p>
                    <label for="stalking"><b style="font-size: 12px;"><?php echo $lang['settings_right_stalk']; ?></b></label><br />
					<input type="checkbox" name="stalking" id="stalking" <?php if($user['hide_inroom'] == 0) echo 'checked=checked'; ?>  /><?php echo $lang['settings_right_stalk_allow']; ?>
					</p>
                    
                    
					<div class="Submitbtn right">
                    	
						<input type="submit" name="submitcomment" value="<?php echo $lang['submit']; ?>">
		   			</div>
	   			</form>
			</div>
		<?php
		}
		if($_GET['page'] == 'email')
		{
		?>
<div style="margin-left: 5px;" class="xl_boxHeader_grey"><div class="titel"><?php echo $lang['mail_settings']; ?></div></div>
	<div style="margin-left: 5px; margin-right: 5px;" class="contentBox">
			<div class="boxContent" style="display: table; width: 100%;">

				<?php
                if(isset($_GET['success']) && $_GET['success'] == 'false')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_general_error']; ?></h3> 
					</div>
				<?php
				}
                elseif(isset($_GET['success']) && $_GET['success'] == 'true')
				{
				?>
					<div class="goodmsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_mail_updated']; ?></h3> 
					</div>
				<?php
				}
				if($user['mail_verified'] != 'true')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_mail_not_verified']; ?></h3> 
					</div>
                <?php
				}
				if(isset($_GET['sent']) && $_GET['sent'] == 'true')
				{
				?>
					<div class="goodmsg" id="habbo_name_message_box"> 
						<?php echo $lang['settings_mail_verify_sent']; ?>
					</div>
				<?php
				}
				if(isset($_GET['validated']) && $_GET['validated'] == 'true')
				{
				?>
					<div class="goodmsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_mail_verified']; ?></h3> 
					</div>
				<?php
				}
$userq = mysql_query("SELECT * FROM users WHERE username = '".$core->EscapeString($users->UserInfo($_SESSION['username']))."' LIMIT 1");
$user = mysql_fetch_array($userq);
$rand = rand(100000, 999999);
$query = mysql_query("UPDATE users SET mail_verified = '".$rand."' WHERE mail = '".$user['mail']."'");
$headers = 'From: niet-op-antwoorden@zengohotel.com "\r\n" . "Content-type: text/html"';

				?>
				<form id="UserEmail" name="UserEmail" action="mailto:<?php echo $user['mail']; ?>" method="post">
					<label for="email"><?php echo $lang['settings_mail_address']; ?></label><br/>
					<input type="text" name="email" id="email" value="<?php echo $user['mail']; ?>" /><br/>
	   			</form>
			
				
			</div>
		<?php
		}
		if($_GET['page'] == 'password')
		{
		?>
<div style="margin-left: 5px;" class="xl_boxHeader_grey"><div class="titel"><?php echo $lang['password_settings']; ?></div></div>
	<div style="margin-left: 5px; margin-right: 5px;" class="contentBox">
			<div class="boxContent" style="display: table; width: 100%;">
				<?php
                if(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'false')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_general_error']; ?></h3> 
					</div>
				<?php
				}
                elseif(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'true')
				{
				?>
					<div class="goodmsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_password_updated']; ?></h3> 
					</div>
				<?php
				}
                elseif(isset($_GET['date']) && $core->EscapeString($_GET['date']) == 'false')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_date_false']; ?></h3> 
					</div>
				<?php
				}
                elseif(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'fould')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_password_fould']; ?></h3> 
					</div>
				<?php
				}
				?>
				<form name="UserPassword" action="functions/updatepassword.php" method="post">
                
                	<label for="bdday"><?php echo $lang['settings_date']; ?></label><br />
                	
                    <select name="bdday" <?php if(isset($_GET["value"]) && $core->EscapeString($_GET["value"] == "1")){ ?> style="border-color: red;color: red;"<?php } ?> id="bdday">
                    
                		<option value="hoi"><?php echo $lang['register_day']; ?></option>
                        
                    	<option value="01">1</option>
                        
                    	<option value="02">2</option>
                        
                  	  	<option value="03">3</option>
                        
                  	 	 <option value="04">4</option>
                         
                    	<option value="05">5</option>
                        
                    	<option value="06">6</option>
                        
                    	<option value="07">7</option>
                        
                    	<option value="08">8</option>
                        
                    	<option value="09">9</option>
                        
                    	<option value="10">10</option>
                        
                    	<option value="11">11</option>
                        
                    	<option value="12">12</option>
                        
                    	<option value="13">13</option>
                        
                    	<option value="14">14</option>
                        
                    	<option value="15">15</option>
                        
                    	<option value="16">16</option>
                        
                   		<option value="17">17</option>
                        
                   		<option value="18">18</option>
                        
                    	<option value="19">19</option>
                        
                    	<option value="20">20</option>
                        
                    	<option value="21">21</option>
                        
                    	<option value="22">22</option>
                        
                    	<option value="23">23</option>
                        
                    	<option value="24">24</option>
                        
                    	<option value="25">25</option>
                        
                    	<option value="26">26</option>
                        
                    	<option value="27">27</option>
                        
                    	<option value="28">28</option>
                        
                    	<option value="29">29</option>
                        
                    	<option value="30">30</option>
                        
                    	<option value="31">31</option>
                	</select> 
                    
                	<select name="bdmonth" <?php if(isset($_GET["value"]) && $core->EscapeString($_GET["value"] == "2")){ ?>style="border-color: red;color: red;"<?php } ?> id="bdmonth">
                    
                		<option value=""><?php echo $lang['register_month']; ?></option>
                        
                    	<option value="01"><?php echo $lang['january'] ?></option>
                        
	                    <option value="02"><?php echo $lang['february']; ?></option>
                        
    	                <option value="03"><?php echo $lang['march']; ?></option>
                        
        	            <option value="04"><?php echo $lang['april']; ?></option>
                        
            	        <option value="05"><?php echo $lang['may']; ?></option>
                        
                	    <option value="06"><?php echo $lang['june']; ?></option>
                        
                    	<option value="07"><?php echo $lang['july']; ?></option>
                        
	                    <option value="08"><?php echo $lang['august']; ?></option>
                        
    	                <option value="09"><?php echo $lang['september']; ?></option>
                        
        	            <option value="10"><?php echo $lang['october']; ?></option>
                        
            	        <option value="11"><?php echo $lang['november']; ?></option>
                        
                	    <option value="12"><?php echo $lang['december']; ?></option>
                        
                	</select> 
                    
                	<select name="bdyear" <?php if(isset($_GET["value"]) && $core->EscapeString($_GET["value"] == "3")){ ?>style="border-color: red;color: red;"<?php } ?> id="bdyear">
                    
	                	<option value=""><?php echo $lang['register_year']; ?></option>
                        
    	                <option value="2010">2010</option>
                        
        	            <option value="2009">2009</option>
                        
            	        <option value="2008">2008</option>
                        
                	    <option value="2007">2007</option>
                        
                    	<option value="2006">2006</option>
                        
	                    <option value="2005">2005</option>
                        
    	                <option value="2004">2004</option>
                        
        	            <option value="2003">2003</option>
                        
            	        <option value="2002">2002</option>
                        
                	    <option value="2001">2001</option>
                        
                    	<option value="2000">2000</option>
                        
	                    <option value="1999">1999</option>
                        
    	                <option value="1998">1998</option>
                        
        	            <option value="1997">1997</option>
                        
            	        <option value="1996">1996</option>
                        
                	    <option value="1995">1995</option>
                        
                    	<option value="1994">1994</option>
                        
	                    <option value="1993">1993</option>
                        
    	                <option value="1992">1992</option>
                        
        	            <option value="1991">1991</option>
                        
            	        <option value="1990">1990</option>
                        
                	    <option value="1989">1989</option>
                        
                    	<option value="1988">1988</option>
                        
	                    <option value="1987">1987</option>
                        
    	                <option value="1986">1986</option>
                        
        	            <option value="1985">1985</option>
                        
            	        <option value="1984">1984</option>
                        
                	    <option value="1983">1983</option>
                        
                    	<option value="1982">1982</option>
                        
	                    <option value="1981">1981</option>
                        
    	                <option value="1980">1980</option>
                        
        	            <option value="1979">1979</option>
                        
            	        <option value="1978">1978</option>
                        
                	    <option value="1977">1977</option>
                        
                    	<option value="1976">1976</option>
                        
	                    <option value="1975">1975</option>
                        
    	                <option value="1974">1974</option>
                        
        	            <option value="1973">1973</option>
                        
            	        <option value="1972">1972</option>
                        
                	    <option value="1971">1971</option>
                        
                    	<option value="1970">1970</option>
                        
               	 	</select>
                    
                    <br />
                	
					<label for="curpassword"><?php echo $lang['settings_current_password']; ?></label><br/>
					<input type="password" name="curpassword" id="curpassword" /><br/>
					<label for="newpassword"><?php echo $lang['settings_new_password']; ?></label><br/>
					<input type="password" name="newpassword" id="newpassword" /><br/>
					<label for="conpassword"><?php echo $lang['settings_confirm_password']; ?></label><br/>
					<input type="password" name="conpassword" id="conpassword" /><br/>
					<div class="Submitbtn right">
						<input type="submit" name="submitcomment" value="<?php echo $lang['submit']; ?>">
		   			</div>
	   			</form>
			</div>
		<?php
		}
		if($_GET['page'] == 'header')
		{
		?>
        <div style="margin-left: 5px;" class="xl_boxHeader_grey"><div class="titel"><?php echo $lang['settings_left_header']; ?></div></div>
	<div style="margin-left: 5px; margin-right: 5px;" class="contentBox">
			<div class="boxContent" style="display: table; width: 100%;">
            				<?php
                if(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'false')
				{
				?>
					<div class="errormsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_headers_failed']; ?></h3> 
					</div>
				<?php
				}
                elseif(isset($_GET['success']) && $core->EscapeString($_GET['success']) == 'true')
				{
				?>
					<div class="goodmsg" id="habbo_name_message_box"> 
						<h3><?php echo $lang['settings_headers_updated']; ?></h3> 
					</div>
				<?php
				}
				?>
				<form action="functions/header.php" method="post">
                
					<p><strong><?php echo $lang['settings_headers']; ?></strong><br/>
					<input type="checkbox" name="header_info" id="header_info" <?php if($user['header_info'] == "0") echo 'checked=checked'; ?> />
					<label for="header_info"><?php echo $lang['settings_headers_pages']; ?></label></p>
					<p><?php echo $lang['settings_headers_example']; ?>:<br/>
                    <img src="Public/Styles/Default/Images/previeuw1.png" /><br /><br />
                    
					<input type="checkbox" name="header_client" id="header_client" <?php if($user['header_client'] == "0") echo 'checked=checked'; ?>  />
					<label for="header_client"><?php echo $lang['settings_headers_client']; ?></label></p>
					<p><?php echo $lang['settings_headers_client_second']; ?></p><br/>

						<input type="submit" value="<?php echo $lang['submit']; ?>">
	   			</form>
        </div>
        <?php
		}
		?>
	</div>
<div style="margin-left: 5px;" class="xl_boxBottom"></div>
</div>
		
<?php include("system/sideads.php"); ?>

	</div> 

	<?php include("system/footer.php"); ?>
</div> 

</body> 
</html>